<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="/opebs/date/css/bootstrap-datetimepicker.css">

<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="/opebs/date/js/bootstrap-datetimepicker.js"></script>

<link rel="stylesheet" href="/opebs/css/bootstrap-select.css">
<script src="/opebs/js/bootstrap-select.js"></script>

<link href="/lib/ueditor/themes/css/umeditor.css" type="text/css" rel="stylesheet">
<script type="text/javascript" charset="utf-8" src="/lib/ueditor/js/umeditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/lib/ueditor/js/editor_api.js"></script>
<script type="text/javascript" src="/lib/ueditor/lang/zh-cn/zh-cn.js"></script>

 <link href="/bootstrap-fileinput-master/css/fileinput.css" media="all" rel="stylesheet" type="text/css"/>
<script src="/bootstrap-fileinput-master/js/fileinput.js" type="text/javascript"></script>
<script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>

<body>
<form class="form-horizontal" id="form-meet-add" style="margin-top: 1%">

    <div class="form-group has-success">
        <label class="col-sm-2 control-label" for="inputSuccess">合同录入阶段</label>
        <div class="col-sm-9">
            <input class="form-control" id="contractTitle" type="text"  value="投后阶段合同" readonly>
        </div>
    </div>


    <div class="form-group has-success">
        <label class="col-sm-2 control-label" for="inputSuccess">时间</label>
        <div class="col-sm-9">
            <div class="input-group date form_date" data-date="" data-date-format="yyyy-mm-dd" data-link-field="state" data-link-format="yyyy-mm-dd">
                <input class="form-control" size="14" type="text" id="contractSigningTime" value="<#if contract??>${contract.contractSigningTime!}</#if>" readonly>
                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
            <input type="hidden" id="state" value="" />
        </div>
    </div>

    <div class="form-group has-success">
        <label class="col-sm-2 control-label" for="inputSuccess">合同签订方</label>
        <div class="col-sm-9">
            <input class="form-control" id="contractSignedParty" type="text"  value="<#if contract??>${contract.contractSignedParty!}</#if>">
        </div>
    </div>

    <div class="form-group has-success">
        <label class="col-sm-2 control-label" for="inputSuccess">履行期限</label>
        <div class="col-sm-9">
                <input class="form-control"  type="text" id="contractLimitTime" value="<#if contract??>${contract.contractLimitTime!}</#if>" >
            <input type="hidden" id="state" value="" />
        </div>
    </div>

    <div class="form-group has-success">
        <label class="col-sm-2 control-label" for="inputSuccess">履行情况：</label>
        <div class="col-sm-9">
            <select id="contractPerformance" name="contractPerformance" class="selectpicker form-control"  data-live-search="true"
                   ">
                <option>请选择</option>
                <#if contractPerformanceList??>
                    <#list contractPerformanceList as m>
                        <option  value="${m.key}" <#if (contract.contractPerformance)??><#if contract.contractPerformance=(m.key)?eval>selected</#if></#if> >${m.value}</option>
                    </#list>
                </#if>
            </select>
        </div>
    </div>

    <div class="form-group has-success">
        <label class="col-sm-2 control-label" for="inputSuccess">合同主要条款</label>
        <div class="col-sm-9">
            <input class="form-control" id="contractContent" type="text"  value="<#if contract??>${contract.contractContent!}</#if>">
        </div>
    </div>

    <#--<div class="form-group has-success">-->
        <#--<label class="col-sm-2 control-label" for="inputSuccess">-->
            <#--合同主要条款-->
        <#--</label>-->
        <#--<div class="col-sm-9">-->
            <#--<script type="text/plain" id="myEditor" style="width:100%;height:150px;"><#if contract??>${contract.contractContent!}</#if></script>-->
        <#--</div>-->
    <#--</div>-->

    <div class="form-group  has-success">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="button" id="save" class="btn btn-default">保存</button>
        </div>
    </div>
</form>
</body>
<script type="text/javascript">
    $('.form_date').datetimepicker({
        language:  'fr',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0
    });
    // var um = UM.getEditor('myEditor',{
    //     //这里可以选择自己需要的工具按钮名称,此处仅选择如下七个
    //     toolbar:['fullscreen source undo redo bold italic underline'],
    //     //focus时自动清空初始化时的内容
    //     autoClearinitialContent:false,
    //     //关闭字数统计
    //     wordCount:false,
    //     //关闭elementPath
    //     elementPathEnabled:false,
    //     //默认的编辑区域高度
    //     initialFrameHeight:300
    //     //更多其他参数，请参考umeditor.config.js中的配置项
    // });
</script>
<script>
    var id = ${id};
    var localId = ${localId};


    $('#save').click(function () {
        var contractSigningTime = $('#contractSigningTime').val();
        var contractTitle = $('#contractTitle').val();
        var contractLimitTime = $('#contractLimitTime').val();
        var contractPerformance = $('#contractPerformance').val();
        if(contractPerformance == '请选择'){
            contractPerformance = '';
        }

        //var content = um.getPlainTxt();
        var  content = $('#contractContent').val();
        var contractSignedParty = $('#contractSignedParty').val();

        $.ajax({
            url:"/contract-ins-upd-del",
            data:{contractSigningTime:contractSigningTime,contractLimitTime:contractLimitTime,contractSignedParty:contractSignedParty,
                contractTitle:contractTitle,contractPerformance:contractPerformance,contractContent:content,id:localId,proID:id},
            async: false,
            success: function(data) {
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            }
        })
    })
</script>
